﻿
using System;
using System.Collections.Generic;
using System.Text;

namespace SharpSoft.Data.GSQL
{
    using SharpSoft.Data.Expressions;
    public class Join
    {
        public JoinType JoinType { get; set; }
        public ListExpression Tables { get; set; }
        public IExpression OnExpression { get; set; }

        public override string ToString()
        {
            string jt = "";
            switch (JoinType)
            {
                case JoinType.Inner:
                    jt = "INNER JOIN";
                    break;
                case JoinType.Full:
                    jt = "FULL JOIN";
                    break;
                case JoinType.Left:
                    jt = "LEFT JOIN";
                    break;
                case JoinType.Right:
                    jt = "RIGHT JOIN";
                    break;
                default:
                    break;
            }
            return $"{jt} {Tables} ON {OnExpression}";
        }
    }
    public enum JoinType
    {
        Inner,
        Full,
        Left,
        Right
    }
}
